package com.woniuxy.yygh.hsop.controller;

import com.woniuxy.yygh.common.result.Result;
import com.woniuxy.yygh.hsop.service.ScheduleService;
import com.woniuxy.yygh.model.hosp.Schedule;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO: 排班信息
 * <P> Date: 2022/3/2:20:05
 * <P> Description:
 */
@RestController
@RequestMapping("/admin/hosp/schedule")
//@CrossOrigin
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    /**
        * TODO: 根据医院编号和科室编号 工作日期 查询排班信息
    **/
    @ApiOperation(value = "根据医院编号和科室编号 工作日期 查询排班信息")
    @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode,
                                  @PathVariable String depcode,
                                  @PathVariable String workDate){
        List<Schedule> list =  scheduleService.getDetailSchedule(hoscode,depcode,workDate);

        return  Result.ok(list);
    }

    /**
        * TODO:医院编号和科室编号 查询排班规则数据
    **/
    @ApiOperation(value = "根据医院编号和科室编号 查询排班规则数据")
    @GetMapping("/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable Integer page,
                                  @PathVariable Integer limit,
                                  @PathVariable String hoscode,
                                  @PathVariable String depcode){
        Map<String, Object> map= scheduleService.getRuleSchedule(page,limit,hoscode,depcode);
        return Result.ok(map);
    }


}
